package com.mycompany.myapp.web.rest;

import com.mycompany.myapp.domain.mongodb.DemoEntity;
import com.mycompany.myapp.service.DemoService;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.validation.Valid;

@RestController
@RequestMapping("/api")
public class DemoResource {

    private final DemoService demoService;

    public DemoResource(DemoService demoService) {
        this.demoService = demoService;
    }

    @PostMapping("/demo")
    @ResponseStatus(HttpStatus.CREATED)
    public void createDemo(@Valid @RequestBody DemoEntity demoEntity){
        demoService.createRecord(demoEntity);
    }
}
